package cn.iocoder.yudao.module.system.dal.mysql.jd;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.jd.RechargePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.jd.RechargeDO;
import org.apache.ibatis.annotations.*;

/**
 * 京东提交生产 Mapper
 *
 * @author 发起人
 */
@Mapper
public interface RechargeMapper extends BaseMapperX<RechargeDO> {

    default PageResult<RechargeDO> selectPage(RechargePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RechargeDO>()
                .eqIfPresent(RechargeDO::getWareNo, reqVO.getWareNo())
                .eqIfPresent(RechargeDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(RechargeDO::getJdOrderNo, reqVO.getJdOrderNo())
                .eqIfPresent(RechargeDO::getProduceAccount, reqVO.getProduceAccount())
                .eqIfPresent(RechargeDO::getTotalPrice, reqVO.getTotalPrice())
                .betweenIfPresent(RechargeDO::getPayTime, reqVO.getPayTime())
                .eqIfPresent(RechargeDO::getNotifyUrl, reqVO.getNotifyUrl())
                .eqIfPresent(RechargeDO::getVendorId, reqVO.getVendorId())
                .eqIfPresent(RechargeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(RechargeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RechargeDO::getId));
    }

     @Select("select * from jd_recharge where jd_order_no= #{jdOrderNo}")
     RechargeDO getRecharge(@Param("jdOrderNo") String jdOrderNo) ;
}